//
//  LooserTableViewCell.m
//  Created by lanou3g on 15/12/19.
//  Copyright © 2015年 张明. All rights reserved.
//

#import "LooserTableViewCell.h"

@implementation LooserTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self p_setUpViews];
    }
    return self;
}

- (void)p_setUpViews{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.titleLable = [[UILabel alloc] init];
    self.titleLable.frame = CGRectMake(self.contentView.frame.size.width * 0.1, 5, self.contentView.frame.size.width * 0.4, self.frame.size.height * 0.2);
    self.titleLable.backgroundColor = [UIColor whiteColor];
    self.titleLable.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:self.titleLable];
    
    self.imv1 = [[UIImageView alloc] init];
    self.imv1.frame = CGRectMake(self.contentView.frame.size.width * 0.1, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv1.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv1];
    
    self.imv2 = [[UIImageView alloc] init];
    self.imv2.frame = CGRectMake(CGRectGetMaxX(self.imv1.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv2.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv2];

    self.imv3 = [[UIImageView alloc] init];
    self.imv3.frame = CGRectMake(CGRectGetMaxX(self.imv2.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv3.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv3];

    self.imv4 = [[UIImageView alloc] init];
    self.imv4.frame = CGRectMake(CGRectGetMaxX(self.imv3.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv4.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv4];

    self.imv5 = [[UIImageView alloc] init];
    self.imv5.frame = CGRectMake(CGRectGetMaxX(self.imv4.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv5.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv5];

    self.imv6 = [[UIImageView alloc] init];
    self.imv6.frame = CGRectMake(CGRectGetMaxX(self.imv5.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.height * 0.3);
    self.imv6.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.imv6];

    self.describeLable = [[UILabel alloc] init];
    self.describeLable.frame = CGRectMake(CGRectGetMinX(self.titleLable.frame), CGRectGetMaxY(self.imv1.frame) + 10, self.contentView.frame.size.width * 0.8, self.frame.size.height * 0.2);
    self.describeLable.backgroundColor = [UIColor clearColor];
    self.describeLable.numberOfLines = 0;
    self.describeLable.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:self.describeLable];
}


- (void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.titleLable.frame = CGRectMake(self.contentView.frame.size.width * 0.05, 5, self.contentView.frame.size.width * 0.4, 20);
    
    self.imv1.frame = CGRectMake(self.contentView.frame.size.width * 0.1, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
    self.imv2.frame = CGRectMake(CGRectGetMaxX(self.imv1.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
     self.imv3.frame = CGRectMake(CGRectGetMaxX(self.imv2.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
    self.imv4.frame = CGRectMake(CGRectGetMaxX(self.imv3.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
    self.imv5.frame = CGRectMake(CGRectGetMaxX(self.imv4.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
    self.imv6.frame = CGRectMake(CGRectGetMaxX(self.imv5.frame) + self.contentView.frame.size.width * 0.05, CGRectGetMaxY(self.titleLable.frame) + 10, self.contentView.frame.size.width * 0.1, self.contentView.frame.size.width * 0.1);
    
   // self.describeLable.frame = CGRectMake(CGRectGetMinX(self.imv1.frame), CGRectGetMaxY(self.imv1.frame) + 10, self.contentView.frame.size.width * 0.8, self.frame.size.height * 0.2);
    self.describeLable.frame = CGRectMake(CGRectGetMinX(self.imv1.frame), CGRectGetMaxY(self.imv1.frame) + 10, self.contentView.frame.size.width * 0.8, self.heighttt);
    }


-(CGFloat)getHeightWithString:(NSString *)string{
    
    CGRect rect = [string boundingRectWithSize:CGSizeMake(self.contentView.frame.size.width * 0.8, 2000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName :[UIFont systemFontOfSize:15.0]} context:nil];
  //  self.describeLable.frame = CGRectMake(CGRectGetMinX(self.imv1.frame), CGRectGetMaxY(self.imv1.frame) + 10, self.contentView.frame.size.width * 0.8, rect.size.height);
    self.heighttt = rect.size.height;
      return rect.size.height + self.contentView.frame.size.width * 0.1 +45;
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
